package cn.weakup.integer;

import sun.misc.VM;

import java.util.Arrays;

/**
 * @author Dawn
 * @version 1.0.0
 * @desc
 * @date 2022/5/16
 */
public class IntegerTest {

    public static void main(String[] args) {
        // 常量池默认-128-127
        Integer a = 100;
        Integer b = 100;
        System.out.println(a == b);

        Integer c = 200;
        Integer d = 200;
        System.out.println(c == d);

        // 通过VM参数设置 -XX:AutoBoxCacheMax=size设置常量池最大值
        // 通过sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high")去查看
        String property = VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
        System.out.println(property);
    }
}
